﻿#region Copyright
/// <copyright>
/// Copyright (c) 2008 Ilia Shramko.
/// Released under the terms of the GNU General Public License.
/// </copyright>
#endregion

using System;
using System.Collections.Generic;
using System.Text;

namespace Osh.Media
{
	public class MediaFolder : IMediaFolder
	{
		private IMediaTree _mediaTree;
		private string _id;
		private string _name;
		private IList<IMedia> _itemList;
		private MediaCollection _items;

		//protected MediaFolder(IMediaTree mediaTree)
		//    : this(mediaTree, string.Empty)
		//{
		//}

		public MediaFolder(IMediaTree mediaTree, string id, string name)
			: this(mediaTree, id, name, new List<IMedia>())
		{
		}

		public MediaFolder(IMediaTree mediaTree, string id, string name, IList<IMedia> items)
		{
			_mediaTree = mediaTree;
			_id = id;
			_name = name;
			_itemList = items;
			_items = new MediaCollection(items);
		}

		protected virtual IList<IMedia> ItemList
		{
			get { return _itemList; }
		}

		#region IMediaFolder
		public virtual string Id
		{
			get { return _id; }
		}

		public virtual IMediaTree Tree
		{
			get { return _mediaTree; }
			protected set { _mediaTree = value; }
		}

		public virtual string Name
		{
			get { return _name; }
			protected set { _name = value; }
		}

		public virtual MediaCollection Items
		{
			get { return _items; }
		}
		#endregion IMediaFolder
	}
}
